package com.songlanyun.modules.rabbitmq.publicbenefitmsg.impl;

import cn.hutool.core.util.ObjectUtil;
import com.songlanyun.common.enums.DonationConstant;
import com.songlanyun.common.utils.custom.ClassConvertUtils;
import com.songlanyun.modules.account.service.UserInfoService;
import com.songlanyun.modules.publicbenefitmsg.model.BuyMsg;
import com.songlanyun.modules.publicbenefitmsg.model.to.PublicBenefitMsgTO;
import com.songlanyun.modules.publicbenefitmsg.service.PublicBenefitMsgService;
import com.songlanyun.modules.rabbitmq.publicbenefitmsg.IPublicBenefitMsgService;
import com.songlanyun.modules.sharebenefitconfig.model.InviteConfig;
import com.songlanyun.modules.signin.entity.SignInRecordEntity;
import com.songlanyun.modules.signin.service.SignInRecordService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * 购买消息
 */
@Service("buyMsgService")
public class BuyMsgServiceImpl implements IPublicBenefitMsgService {

    @Resource
    private PublicBenefitMsgService publicBenefitMsgService;

    @Override
    public void saveMsg(PublicBenefitMsgTO to) {
        //保存公益记录
        publicBenefitMsgService.add(
                to.getUserId(),
                DonationConstant.MsgType.BUY,
                ClassConvertUtils.transformObject(to.getMsgBody(), BuyMsg.class),
                to.getContent()
        );
    }
}
